package calculation.base;

/**
 * This class models a subject.
 * @author xiawenjing sunliyi
 * @version 1.0.0
 */
public class Subject {
    /**
    *学科名称
    */
    private String name;
     /**
    *单科成绩
    */
    private double score;
     /**
    *学科学分
    */
    private int credit;
    private double Gradepoint;
    private String isPass;

    public String getName(){
        return name;
    }
    public double getScore(){
        return score;
    }
    public int getCredit(){
        return credit;
    }
 

    /**
    *判断科目是否及格，并返回String类型的对象值
    */
    private String isPass(double score){
         if((score>=0)&&(score<=100))
        {
            if(score<60)
                isPass="不合格";
            else if(score<=69)
                isPass="合格";
            else if(score<=75)
                isPass="中等";
            else if(score<=84)
                isPass="良好";
            else
                isPass="优秀";
        }
        else
            isPass="无法判断";
        return isPass;
    }
    /**
    *打印列表中一行字节
    */ 
   public String toString(){
       return name+"_"+credit+"_"+Gradepoint+"_"+score+"_"+isPass(score);
    }
   
   public Subject(String initialsubject,int initialcredit,double initialscore) {
	   this();
	   name = initialsubject;
	   credit = initialcredit;
	   score = initialscore;
   }
   public Subject() {
   }

}
